package com.lancoo.dictionary.utils;

import org.xutils.common.util.DensityUtil;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ItemDecoration;
import android.support.v7.widget.RecyclerView.State;
import android.view.View;

public class DitchItemDecoration extends ItemDecoration {
	private int ditchPx;
	
	public DitchItemDecoration(int ditchPx) {
		this.ditchPx = ditchPx;
	}
	public DitchItemDecoration(float ditchDp) {
		this.ditchPx = DensityUtil.dip2px(ditchDp);
	}

	public int getDitchPx() {
		return ditchPx;
	}
	public int getDitchDp() {
		return DensityUtil.px2dip(ditchPx);
	}

	public void setDitchPx(int ditchPx) {
		this.ditchPx = ditchPx;
	}
	public void setDitchDp(float ditchDp) {
		this.ditchPx = DensityUtil.dip2px(ditchDp);
	}
	
	

	@Override
	public void getItemOffsets(Rect outRect, View view, RecyclerView parent, State state) {
		outRect.set(0, 0, 0, ditchPx);
	}
}
